import json
from aiogram.dispatcher.filters import BoundFilter
from aiogram.types import CallbackQuery


class ActionTypeFilter(BoundFilter):
    key = "callback_data_filter"

    def __init__(self, callback_action):
        self.callback_action = callback_action

    async def check(self, callback_query: CallbackQuery):
        return self.callback_action == callback_query.data.split(":")[0]
